<!DOCTYPE html>
<html lang="zh-CN" data-theme="light">

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width,initial-scale=1" />
  <meta name="generator" content="VuePress 2.0.0-beta.51" />
  <meta name="theme" content="VuePress Theme Hope" />
  <meta property="og:url" content="https://pro.autojs.org/docs/zh/v8/util.html">
  <meta property="og:site_name" content="Auto.js Pro文档">
  <meta property="og:title" content="util - 工具">
  <meta property="og:type" content="article">
  <meta property="og:updated_time" content="2022-10-23T11:50:15.000Z">
  <meta property="og:locale" content="zh-CN">
  <meta property="og:locale:alternate" content="en-US">
  <meta property="article:modified_time" content="2022-10-23T11:50:15.000Z">
  <link rel="alternate" hreflang="en-us" href="https://pro.autojs.org/docs/en/zh/v8/util.html">
  <link rel="icon" href="https://pro.autojs.org/docs/favicon.ico">
  <link rel="manifest" href="https://pro.autojs.org/docs/manifest.webmanifest" crossorigin="use-credentials">
  <meta name="theme-color" content="#46bd87">
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
  <title>util - 工具 | Auto.js Pro文档</title>
  <meta name="description" content="支持Node.js的自动化工作流JavaScript IDE">
  <style>
    :root {
      --bg-color: #fff;
    }

    html[data-theme="dark"] {
      --bg-color: #1d2025;
    }

    html,
    body {
      background-color: var(--bg-color);
    }
  </style>
  <script>
    const userMode = localStorage.getItem("vuepress-theme-hope-scheme");
    const systemDarkMode =
      window.matchMedia &&
      window.matchMedia("(prefers-color-scheme: dark)").matches;

    if (userMode === "dark" || (userMode !== "light" && systemDarkMode)) {
      document.querySelector("html").setAttribute("data-theme", "dark");
    }
  </script>
  <link rel="stylesheet" href="../../assets/style.ae9cb182.css">
  <link rel="modulepreload" href="../../assets/app.6aa2b576.js">
  <link rel="modulepreload" href="../../assets/util.html.377c99d5.js">
  <link rel="modulepreload" href="../../assets/_plugin-vue_export-helper.cdc0426e.js">
  <link rel="modulepreload" href="../../assets/util.html.ed43563f.js">
</head>

<body>


  <!-- Copyright � 2008. Spidersoft Ltd -->
  <style>
    A.applink:hover {
      border: 2px dotted #DCE6F4;
      padding: 2px;
      background-color: #ffff00;
      color: green;
      text-decoration: none
    }

    A.applink {
      border: 2px dotted #DCE6F4;
      padding: 2px;
      color: #2F5BFF;
      background: transparent;
      text-decoration: none
    }

    A.info {
      color: #2F5BFF;
      background: transparent;
      text-decoration: none
    }

    A.info:hover {
      color: green;
      background: transparent;
      text-decoration: underline
    }
  </style>



  <div id="app"><!--[--><!--[--><!--[--><span tabindex="-1"></span><a href="#main-content"
      class="skip-link sr-only">Skip to content</a><!--]-->
    <div class="theme-container has-toc"><!--[--><!--[-->
      <header class="navbar">
        <div class="navbar-left"><button class="toggle-sidebar-button" title="Toggle Sidebar"><span
              class="icon"></span></button><!----><a href="../../docs.html" class="brand"><img class="logo"
              src="../../logo.png" alt="Auto.js Pro文档"><!----><span class="site-name hide-in-pad">Auto.js
              Pro文档</span></a><!----></div>
        <div class="navbar-center"><!---->
          <nav class="nav-links">
            <div class="nav-item hide-in-mobile"><a href="../../docs.html" class="nav-link"
                aria-label="Auto.js Pro"><span class="icon iconfont icon-home"></span>Auto.js Pro<!----></a></div>
            <div class="nav-item hide-in-mobile"><a href="../guide/guide.html" class="nav-link" aria-label="指南"><span
                  class="icon iconfont icon-creative"></span>指南<!----></a></div>
            <div class="nav-item hide-in-mobile"><a href="v8.html" class="nav-link active" aria-label="第一代API文档"><span
                  class="icon iconfont icon-note"></span>第一代API文档<!----></a></div>
            <div class="nav-item hide-in-mobile"><a href="../v9/v9.html" class="nav-link" aria-label="第二代API文档"><span
                  class="icon iconfont icon-note"></span>第二代API文档<!----></a></div>
            <div class="nav-item hide-in-mobile">
              <div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="官网与相关链接"><span
                    class="title"><span class="icon iconfont icon-discover"></span>官网与相关链接</span><span
                    class="arrow"></span>
                  <ul class="nav-dropdown">
                    <li class="dropdown-item"><a href="../../../pro.autojs.html" rel="noopener noreferrer"
                        target="_blank" aria-label="官网与软件下载" class="nav-link"><!---->官网与软件下载<span><svg
                            class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
                            focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
                            <path fill="currentColor"
                              d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                            </path>
                            <polygon fill="currentColor"
                              points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                            </polygon>
                          </svg><span class="external-link-icon-sr-only">open in new window</span></span><!----></a>
                    </li>
                    <li class="dropdown-item"><a href="https://blog.autojs.org/" rel="noopener noreferrer"
                        target="_blank" aria-label="官方博客" class="nav-link"><!---->官方博客<span><svg
                            class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
                            focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
                            <path fill="currentColor"
                              d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                            </path>
                            <polygon fill="currentColor"
                              points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                            </polygon>
                          </svg><span class="external-link-icon-sr-only">open in new window</span></span><!----></a>
                    </li>
                    <li class="dropdown-item"><a href="https://pd.qq.com/s/gosos5" rel="noopener noreferrer"
                        target="_blank" aria-label="官方频道" class="nav-link"><!---->官方频道<span><svg
                            class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
                            focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
                            <path fill="currentColor"
                              d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                            </path>
                            <polygon fill="currentColor"
                              points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                            </polygon>
                          </svg><span class="external-link-icon-sr-only">open in new window</span></span><!----></a>
                    </li>
                  </ul>
                </button></div>
            </div>
          </nav><!---->
        </div>
        <div class="navbar-right"><!---->
          <div class="nav-item">
            <div class="dropdown-wrapper i18n-dropdown"><button class="dropdown-title" type="button"
                aria-label="选择语言"><!--[--><svg xmlns="http://www.w3.org/2000/svg" class="icon i18n-icon"
                  viewBox="0 0 1024 1024" fill="currentColor" aria-label="i18n icon"
                  style="width:1rem;height:1rem;vertical-align:middle;">
                  <path
                    d="M379.392 460.8 494.08 575.488l-42.496 102.4L307.2 532.48 138.24 701.44l-71.68-72.704L234.496 460.8l-45.056-45.056c-27.136-27.136-51.2-66.56-66.56-108.544h112.64c7.68 14.336 16.896 27.136 26.112 35.84l45.568 46.08 45.056-45.056C382.976 312.32 409.6 247.808 409.6 204.8H0V102.4h256V0h102.4v102.4h256v102.4H512c0 70.144-37.888 161.28-87.04 210.944L378.88 460.8zM576 870.4 512 1024H409.6l256-614.4H768l256 614.4H921.6l-64-153.6H576zM618.496 768h196.608L716.8 532.48 618.496 768z">
                  </path>
                </svg><!--]--><span class="arrow"></span>
                <ul class="nav-dropdown">
                  <li class="dropdown-item"><a href="../../en/en.html" class="nav-link"
                      aria-label="English"><!---->English<!----></a></li>
                  <li class="dropdown-item"><a aria-current="page" href="util.html"
                      class="router-link-active router-link-exact-active nav-link active"
                      aria-label="简体中文"><!---->简体中文<!----></a></li>
                </ul>
              </button></div>
          </div><!---->
          <div class="nav-item hide-in-mobile"><button id="appearance-switch"><svg xmlns="http://www.w3.org/2000/svg"
                class="icon auto-icon" viewBox="0 0 1024 1024" fill="currentColor" aria-label="auto icon"
                style="display:block;">
                <path
                  d="M512 992C246.92 992 32 777.08 32 512S246.92 32 512 32s480 214.92 480 480-214.92 480-480 480zm0-840c-198.78 0-360 161.22-360 360 0 198.84 161.22 360 360 360s360-161.16 360-360c0-198.78-161.22-360-360-360zm0 660V212c165.72 0 300 134.34 300 300 0 165.72-134.28 300-300 300z">
                </path>
              </svg><svg xmlns="http://www.w3.org/2000/svg" class="icon dark-icon" viewBox="0 0 1024 1024"
                fill="currentColor" aria-label="dark icon" style="display:none;">
                <path
                  d="M524.8 938.667h-4.267a439.893 439.893 0 0 1-313.173-134.4 446.293 446.293 0 0 1-11.093-597.334A432.213 432.213 0 0 1 366.933 90.027a42.667 42.667 0 0 1 45.227 9.386 42.667 42.667 0 0 1 10.24 42.667 358.4 358.4 0 0 0 82.773 375.893 361.387 361.387 0 0 0 376.747 82.774 42.667 42.667 0 0 1 54.187 55.04 433.493 433.493 0 0 1-99.84 154.88 438.613 438.613 0 0 1-311.467 128z">
                </path>
              </svg><svg xmlns="http://www.w3.org/2000/svg" class="icon light-icon" viewBox="0 0 1024 1024"
                fill="currentColor" aria-label="light icon" style="display:none;">
                <path
                  d="M952 552h-80a40 40 0 0 1 0-80h80a40 40 0 0 1 0 80zM801.88 280.08a41 41 0 0 1-57.96-57.96l57.96-58a41.04 41.04 0 0 1 58 58l-58 57.96zM512 752a240 240 0 1 1 0-480 240 240 0 0 1 0 480zm0-560a40 40 0 0 1-40-40V72a40 40 0 0 1 80 0v80a40 40 0 0 1-40 40zm-289.88 88.08-58-57.96a41.04 41.04 0 0 1 58-58l57.96 58a41 41 0 0 1-57.96 57.96zM192 512a40 40 0 0 1-40 40H72a40 40 0 0 1 0-80h80a40 40 0 0 1 40 40zm30.12 231.92a41 41 0 0 1 57.96 57.96l-57.96 58a41.04 41.04 0 0 1-58-58l58-57.96zM512 832a40 40 0 0 1 40 40v80a40 40 0 0 1-80 0v-80a40 40 0 0 1 40-40zm289.88-88.08 58 57.96a41.04 41.04 0 0 1-58 58l-57.96-58a41 41 0 0 1 57.96-57.96z">
                </path>
              </svg></button></div>
          <div class="search-box" role="search" data-v-f3875574><input value="" aria-label="Search" class=""
              placeholder="Search" autocomplete="off" spellcheck="false" data-v-f3875574><!----></div><!----><button
            class="toggle-navbar-button" aria-label="Toggle Navbar" aria-expanded="false"
            aria-controls="nav-screen"><span class="button-container"><span class="button-top"></span><span
                class="button-middle"></span><span class="button-bottom"></span></span></button>
        </div>
      </header><!----><!--]--><!---->
      <div class="toggle-sidebar-wrapper"><span class="arrow left"></span></div>
      <aside class="sidebar"><!--[--><!----><!--]-->
        <ul class="sidebar-links">
          <li>
            <section class="sidebar-group">
              <p class="sidebar-heading"><!----><span class="title">指南</span><!----></p>
              <ul class="sidebar-links">
                <li><!--[--><a href="v8.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="阅读须知"><!---->阅读须知<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
              </ul>
            </section>
          </li>
          <li>
            <section class="sidebar-group">
              <p class="sidebar-heading"><!----><span class="title">API文档</span><!----></p>
              <ul class="sidebar-links">
                <li>
                  <section class="sidebar-group"><button class="sidebar-heading clickable"><!----><span
                        class="title">自动化 -
                        控件操作</span><span class="arrow down"></span></button>
                    <ul class="sidebar-links">
                      <li><!--[--><a href="./automator/"
                          class="router-link-active router-link-exact-active nav-link sidebar-link sidebar-page"
                          aria-label="入门介绍" aria-current="page"><!---->入门介绍<!----></a>
                        <ul class="sidebar-sub-headers"></ul><!--]-->
                      </li>
                      <li><!--[--><a href="./automator/selector.html" class="nav-link sidebar-link sidebar-page"
                          aria-label="选择器"><!---->选择器<!----></a>
                        <ul class="sidebar-sub-headers"></ul><!--]-->
                      </li>
                      <li><!--[--><a href="./automator/uiobject.html" class="nav-link sidebar-link sidebar-page"
                          aria-label="控件和控件集合"><!---->控件和控件集合<!----></a>
                        <ul class="sidebar-sub-headers"></ul><!--]-->
                      </li>
                      <li><!--[--><a href="./automator/api.html" class="nav-link sidebar-link sidebar-page"
                          aria-label="automator与其他函数"><!---->automator与其他函数<!----></a>
                        <ul class="sidebar-sub-headers"></ul><!--]-->
                      </li>
                    </ul>
                  </section>
                </li>
                <li><!--[--><a href="./coordinatesBasedAutomation.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="自动化 - 坐标操作"><!---->自动化 -
                    坐标操作<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./app.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="app - 应用"><!---->app -
                    应用<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./base64.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="base64"><!---->base64<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./colors.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="colors - 颜色"><!---->colors - 颜色<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./canvas.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="canvas - 画布"><!---->canvas - 画布<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./console.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="console - 控制台"><!---->console - 控制台<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./crypto.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="crypto - 加解密与消息摘要"><!---->crypto - 加解密与消息摘要<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./debug.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="debug - 调试工具"><!---->debug - 调试工具<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./device.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="device - 设备"><!---->device - 设备<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./dialogs.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="dialogs - 对话框"><!---->dialogs - 对话框<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./engines.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="engines - 脚本引擎"><!---->engines - 脚本引擎<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./events.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="events - 事件与监听"><!---->events - 事件与监听<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./floaty.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="floaty - 悬浮窗"><!---->floaty - 悬浮窗<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./files.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="files - 文件系统"><!---->files - 文件系统<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./globals.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="globals - 全局变量与函数"><!---->globals - 全局变量与函数<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./http.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="http - HTTP网络请求"><!---->http - HTTP网络请求<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./images.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="images - 图片处理"><!---->images - 图片处理<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./keys.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="keys - 按键模拟"><!---->keys
                    - 按键模拟<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./media.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="media - 多媒体"><!---->media
                    - 多媒体<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./modules.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="module - 模块"><!---->module - 模块<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./ocr.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="ocr - 文字识别"><!---->ocr -
                    文字识别<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./plugins.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="plugins - 插件"><!---->plugins - 插件<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./powerManager.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="power_manager - 电源管理"><!---->power_manager - 电源管理<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./sensors.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="sensors - 传感器"><!---->sensors - 传感器<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./shell.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="shell - Shell命令"><!---->shell - Shell命令<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./storages.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="storages - 本地存储"><!---->storages - 本地存储<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./settings.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="settings - 设置"><!---->settings - 设置<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./threads.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="threads - 多线程"><!---->threads - 多线程<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./timers.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="timers - 定时器"><!---->timers - 定时器<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./timedTasks.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="work_manager - 定时与任务"><!---->work_manager - 定时与任务<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li>
                  <section class="sidebar-group"><button class="sidebar-heading clickable"><!----><span
                        class="title">ui - 用户界面</span><span class="arrow down"></span></button>
                    <ul class="sidebar-links">
                      <li><a href="/docs/zh/v8/ui/ui.html" class="nav-link sidebar-link sidebar-page"
                          aria-label="ui入门介绍"><!---->ui入门介绍<!----></a>
                        <ul class="sidebar-sub-headers"></ul>
                      </li>
                      <li><a href="/docs/zh/v8/ui/basic.html" class="nav-link sidebar-link sidebar-page"
                          aria-label="基础布局与控件"><!---->基础布局与控件<!----></a>
                        <ul class="sidebar-sub-headers"></ul>
                      </li>
                      <li><a href="/docs/zh/v8/ui/advanced.html" class="nav-link sidebar-link sidebar-page"
                          aria-label="其他布局与控件"><!---->其他布局与控件<!----></a>
                        <ul class="sidebar-sub-headers"></ul>
                      </li>
                      <li><a href="/docs/zh/v8/ui/api.html" class="nav-link sidebar-link sidebar-page"
                          aria-label="api文档"><!---->api文档<!----></a>
                        <ul class="sidebar-sub-headers"></ul>
                      </li>
                      <li><a href="/docs/zh/v8/ui/customWidget.html" class="nav-link sidebar-link sidebar-page"
                          aria-label="自定义控件"><!---->自定义控件<!----></a>
                        <ul class="sidebar-sub-headers"></ul>
                      </li>
                      <li><a aria-current="page" href="/docs/zh/v8/ui/webview.html"
                          class="router-link-active router-link-exact-active nav-link sidebar-link sidebar-page"
                          aria-label="使用Web编写界面"><!---->使用Web编写界面<!----></a>
                        <ul class="sidebar-sub-headers"></ul>
                      </li>
                    </ul>
                  </section>
                </li>
                <li><!--[--><a href="./util.html" class="nav-link sidebar-link sidebar-page active"
                    aria-label="util - 工具"><!---->util -
                    工具<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./webSocket.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="WebSocket"><!---->WebSocket<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
                <li><!--[--><a href="./zip.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="zip - 压缩与解压"><!---->zip -
                    压缩与解压<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
              </ul>
            </section>
          </li>
          <li>
            <section class="sidebar-group">
              <p class="sidebar-heading"><!----><span class="title">进阶</span><!----></p>
              <ul class="sidebar-links">
                <li><!--[--><a href="scriptingJava.html" class="nav-link sidebar-link sidebar-page"
                    aria-label="和Java交互"><!---->和Java交互<!----></a>
                  <ul class="sidebar-sub-headers"></ul><!--]-->
                </li>
              </ul>
            </section>
          </li>
        </ul><!--[--><!----><!--]-->
      </aside><!--[-->
      <main class="page" id="main-content"><!--[--><!---->
        <nav class="breadcrumb disable"></nav>
        <div class="page-title">
          <h1><!---->util - 工具</h1>
          <div class="page-info"><span class="date-info" aria-label="写作日期📅" data-balloon-pos="down"><svg
                xmlns="http://www.w3.org/2000/svg" class="icon calendar-icon" viewBox="0 0 1024 1024"
                fill="currentColor" aria-label="calendar icon">
                <path
                  d="M716.4 110.137c0-18.753-14.72-33.473-33.472-33.473-18.753 0-33.473 14.72-33.473 33.473v33.473h66.993v-33.473zm-334.87 0c0-18.753-14.72-33.473-33.473-33.473s-33.52 14.72-33.52 33.473v33.473h66.993v-33.473zm468.81 33.52H716.4v100.465c0 18.753-14.72 33.473-33.472 33.473a33.145 33.145 0 01-33.473-33.473V143.657H381.53v100.465c0 18.753-14.72 33.473-33.473 33.473a33.145 33.145 0 01-33.473-33.473V143.657H180.6A134.314 134.314 0 0046.66 277.595v535.756A134.314 134.314 0 00180.6 947.289h669.74a134.36 134.36 0 00133.94-133.938V277.595a134.314 134.314 0 00-133.94-133.938zm33.473 267.877H147.126a33.145 33.145 0 01-33.473-33.473c0-18.752 14.72-33.473 33.473-33.473h736.687c18.752 0 33.472 14.72 33.472 33.473a33.145 33.145 0 01-33.472 33.473z">
                </path>
              </svg><span>2022年10月22日</span>
              <meta property="datePublished" content="2022-10-22T07:36:15.000Z">
            </span></div>
          <hr>
        </div>
        <div class="toc-place-holder">
          <aside id="toc">
            <div class="toc-header">此页内容</div>
            <div class="toc-wrapper">
              <ul class="toc-list"><!--[-->
                <li class="toc-item"><a aria-current="page" href="https://pro.autojs.org/docs/zh/v8/util.html#util-java"
                    class="router-link-active router-link-exact-active toc-link level2">$util.java</a></li>
                <ul class="toc-list"><!--[-->
                  <li class="toc-item"><a aria-current="page"
                      href="https://pro.autojs.org/docs/zh/v8/util.html#util-java-instanceof-obj-clazz"
                      class="router-link-active router-link-exact-active toc-link level3">$util.java.instanceOf(obj,
                      clazz)</a></li><!----><!--]--><!--[-->
                  <li class="toc-item"><a aria-current="page"
                      href="https://pro.autojs.org/docs/zh/v8/util.html#util-java-array-type-size"
                      class="router-link-active router-link-exact-active toc-link level3">$util.java.array(type,
                      size)</a></li><!----><!--]--><!--[-->
                  <li class="toc-item"><a aria-current="page"
                      href="https://pro.autojs.org/docs/zh/v8/util.html#util-java-tojsarray-list-nulllisttoemptyarray"
                      class="router-link-active router-link-exact-active toc-link level3">$util.java.toJsArray(list,
                      nullListToEmptyArray)</a></li><!----><!--]--><!--[-->
                  <li class="toc-item"><a aria-current="page"
                      href="https://pro.autojs.org/docs/zh/v8/util.html#util-java-objecttomap-obj"
                      class="router-link-active router-link-exact-active toc-link level3">$util.java.objectToMap(obj)</a>
                  </li><!----><!--]--><!--[-->
                  <li class="toc-item"><a aria-current="page"
                      href="https://pro.autojs.org/docs/zh/v8/util.html#util-java-maptoobject"
                      class="router-link-active router-link-exact-active toc-link level3">$util.java.mapToObject</a>
                  </li><!----><!--]-->
                </ul><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-format-format-args"
                    class="router-link-active router-link-exact-active toc-link level2">$util.format(format[,
                    ...args])</a></li><!----><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-inspect-object-options"
                    class="router-link-active router-link-exact-active toc-link level2">$util.inspect(object[,
                    options])</a></li><!----><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-extend-target-source"
                    class="router-link-active router-link-exact-active toc-link level2">$util.extend(target, source)</a>
                </li><!----><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-isarray-object"
                    class="router-link-active router-link-exact-active toc-link level2">$util.isArray(object)</a></li>
                <!----><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-isboolean-object"
                    class="router-link-active router-link-exact-active toc-link level2">$util.isBoolean(object)</a></li>
                <!----><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-isdate-object"
                    class="router-link-active router-link-exact-active toc-link level2">$util.isDate(object)</a></li>
                <!----><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-iserror-object"
                    class="router-link-active router-link-exact-active toc-link level2">$util.isError(object)</a></li>
                <!----><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-isfunction-object"
                    class="router-link-active router-link-exact-active toc-link level2">$util.isFunction(object)</a>
                </li><!----><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-isnull-object"
                    class="router-link-active router-link-exact-active toc-link level2">$util.isNull(object)</a></li>
                <!----><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-isnullorundefined-object"
                    class="router-link-active router-link-exact-active toc-link level2">$util.isNullOrUndefined(object)</a>
                </li><!----><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-isnumber-object"
                    class="router-link-active router-link-exact-active toc-link level2">$util.isNumber(object)</a></li>
                <!----><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-isobject-object"
                    class="router-link-active router-link-exact-active toc-link level2">$util.isObject(object)</a></li>
                <!----><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-isprimitive-object"
                    class="router-link-active router-link-exact-active toc-link level2">$util.isPrimitive(object)</a>
                </li><!----><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-isregexp-object"
                    class="router-link-active router-link-exact-active toc-link level2">$util.isRegExp(object)</a></li>
                <!----><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-isstring-object"
                    class="router-link-active router-link-exact-active toc-link level2">$util.isString(object)</a></li>
                <!----><!--]--><!--[-->
                <li class="toc-item"><a aria-current="page"
                    href="https://pro.autojs.org/docs/zh/v8/util.html#util-isundefined-object"
                    class="router-link-active router-link-exact-active toc-link level2">$util.isUndefined(object)</a>
                </li><!----><!--]-->
              </ul>
            </div>
          </aside>
        </div><!---->
        <div class="theme-hope-content">
          <h1 id="util-工具" tabindex="-1"><a class="header-anchor" href="#util-工具" aria-hidden="true">#</a> util - 工具
          </h1>
          <p>
            util模块是对齐早期Node.js的util模块而实现的，另外为方便Java交互而增加了<code>$util<span class="token punctuation">.</span>java</code>对象。
          </p>
          <h2 id="util-java" tabindex="-1"><a class="header-anchor" href="#util-java" aria-hidden="true">#</a>
            $util.java</h2>
          <p>提供Java交互的辅助工具。</p>
          <h3 id="util-java-instanceof-obj-clazz" tabindex="-1"><a class="header-anchor"
              href="#util-java-instanceof-obj-clazz" aria-hidden="true">#</a> $util.java.instanceOf(obj, clazz)</h3>
          <ul>
            <li><code><span class="token property">obj</span></code> {any} Java对象</li>
            <li><code><span class="token property">clazz</span></code> {string} 类名</li>
            <li>返回 {boolean}</li>
          </ul>
          <p>
            判断一个对象是否属于某个指定的类的实例，如果是，返回<code><span class="token boolean">true</span></code>，否则返回<code><span class="token boolean">false</span></code>。
          </p>
          <h3 id="util-java-array-type-size" tabindex="-1"><a class="header-anchor" href="#util-java-array-type-size"
              aria-hidden="true">#</a> $util.java.array(type, size)</h3>
          <ul>
            <li><code><span class="token property">type</span></code> {string} 数组类型，可以是一个Java类名，或者是以下初始类型的名称： <ul>
                <li><code><span class="token string">&quot;int&quot;</span></code></li>
                <li><code><span class="token string">&quot;long&quot;</span></code></li>
                <li><code><span class="token string">&quot;double&quot;</span></code></li>
                <li><code><span class="token string">&quot;char&quot;</span></code></li>
                <li><code><span class="token string">&quot;byte&quot;</span></code></li>
                <li><code><span class="token string">&quot;float&quot;</span></code></li>
              </ul>
            </li>
            <li><code><span class="token property">size</span></code> {number} 数组大小</li>
            <li>返回 {Java数组}</li>
          </ul>
          <p>
            创建一个Java数组并返回。例如创建二进制byte数组<code><span class="token keyword">let</span> bytes <span class="token operator">=</span> $util<span class="token punctuation">.</span>java<span class="token punctuation">.</span><span class="token function">array</span><span class="token punctuation">(</span><span class="token string">&#39;byte&#39;</span><span class="token punctuation">,</span> <span class="token number">1024</span><span class="token punctuation">)</span></code>。
          </p>
          <h3 id="util-java-tojsarray-list-nulllisttoemptyarray" tabindex="-1"><a class="header-anchor"
              href="#util-java-tojsarray-list-nulllisttoemptyarray" aria-hidden="true">#</a> $util.java.toJsArray(list,
            nullListToEmptyArray)</h3>
          <ul>
            <li><code><span class="token property">list</span></code> {List}
              <code>java<span class="token punctuation">.</span>util<span class="token punctuation">.</span>List</code>列表对象
            </li>
            <li><code><span class="token property">nullListToEmptyArray</span></code> {boolean} null列表对象是否转化为空数组</li>
            <li>返回 {Array}</li>
          </ul>
          <p>将Java列表转换为javascript数组。</p>
          <h3 id="util-java-objecttomap-obj" tabindex="-1"><a class="header-anchor" href="#util-java-objecttomap-obj"
              aria-hidden="true">#</a> $util.java.objectToMap(obj)</h3>
          <ul>
            <li><code><span class="token property">obj</span></code> {any} 对象</li>
            <li>返回 {java.util.Map}</li>
          </ul>
          <p>将JavaScript
            object对象转换成<code>java<span class="token punctuation">.</span>util<span class="token punctuation">.</span>Map</code>。
          </p>
          <h3 id="util-java-maptoobject" tabindex="-1"><a class="header-anchor" href="#util-java-maptoobject"
              aria-hidden="true">#</a> $util.java.mapToObject</h3>
          <ul>
            <li><code><span class="token property">map</span></code> {Map} Java Map对象</li>
            <li>返回 {obj}</li>
          </ul>
          <p>
            将<code>java<span class="token punctuation">.</span>util<span class="token punctuation">.</span>Map</code>的java对象转换成JavaScript
            object对象。</p>
          <h2 id="util-format-format-args" tabindex="-1"><a class="header-anchor" href="#util-format-format-args"
              aria-hidden="true">#</a> $util.format(format[, ...args])</h2>
          <ul>
            <li><code><span class="token property">format</span></code> {string}
              类似<code><span class="token property">printf</span></code>的格式字符串。</li>
          </ul>
          <p>
            <code>$util<span class="token punctuation">.</span><span class="token function">format</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>
            方法使用第一个参数返回一个格式化的字符串作为类似<code><span class="token property">printf</span></code>的格式。</p>
          <p>第一个参数是一个包含零个或多个 <em>placeholder</em> 标记的字符串。 每个占位符标记都替换为从对应的论据。 支持的占位符有：</p>
          <ul>
            <li><code><span class="token operator">%</span>s</code> - 字符串。</li>
            <li><code><span class="token operator">%</span>d</code> - 数字（整数或浮点值）。</li>
            <li><code><span class="token operator">%</span>i</code> - 整数。</li>
            <li><code><span class="token operator">%</span>f</code> - 浮点值。</li>
            <li><code><span class="token operator">%</span>j</code> - JSON。 如果参数被替换为字符串
              <code><span class="token string">&#39;[Circular]&#39;</span></code>包含循环引用。</li>
            <li><code><span class="token operator">%</span>o</code> - 对象。 对象的字符串表示： 使用通用的 JavaScript 对象格式。 类似于
              <code>$util<span class="token punctuation">.</span><span class="token function">inspect</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>，带有选项
              <code><span class="token punctuation">{</span> <span class="token literal-property property">showHidden</span><span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span> <span class="token literal-property property">depth</span><span class="token operator">:</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token literal-property property">showProxy</span><span class="token operator">:</span> <span class="token boolean">true</span> <span class="token punctuation">}</span></code>。
              这将显示完整的对象，包括不可枚举的符号和属性。</li>
            <li><code><span class="token operator">%</span><span class="token constant">O</span></code> - 对象。 具有通用
              JavaScript 对象格式的对象的字符串表示形式。 类似于
              <code>$util<span class="token punctuation">.</span><span class="token function">inspect</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>
              没有选项。 这将显示不包括不可枚举符号和属性的完整对象。</li>
            <li><code><span class="token operator">%</span><span class="token operator">%</span></code> -
              单个百分号（<code><span class="token string">&#39;%&#39;</span></code>）。 这不会消耗一个论点。</li>
          </ul>
          <p>如果占位符没有对应的参数，则占位符为没有被替换。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>$util<span class="token punctuation">.</span><span class="token function">format</span><span class="token punctuation">(</span><span class="token string">&#39;%s:%s&#39;</span><span class="token punctuation">,</span> <span class="token string">&#39;foo&#39;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: &#39;foo:%s&#39;</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <p>如果传递给
            <code>$util<span class="token punctuation">.</span><span class="token function">format</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>
            方法的参数多于占位符的数量，则额外的参数将被强制转换为字符串，然后连接到返回的字符串，每个字符串由空格分隔。
            <code><span class="token keyword">typeof</span></code> 为
            <code><span class="token string">&#39;object&#39;</span></code> 或
            <code><span class="token string">&#39;symbol&#39;</span></code>
            的过多参数（<code><span class="token keyword">null</span></code> 除外）将由
            <code>$util<span class="token punctuation">.</span><span class="token function">inspect</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>
            转换。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>$util<span class="token punctuation">.</span><span class="token function">format</span><span class="token punctuation">(</span><span class="token string">&#39;%s:%s&#39;</span><span class="token punctuation">,</span> <span class="token string">&#39;foo&#39;</span><span class="token punctuation">,</span> <span class="token string">&#39;bar&#39;</span><span class="token punctuation">,</span> <span class="token string">&#39;baz&#39;</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#39;foo:bar baz&#39;</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
            </div>
          </div>
          <p>如果第一个参数不是字符串，则
            <code>$util<span class="token punctuation">.</span><span class="token function">format</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>
            返回一个字符串，该字符串是由空格分隔的所有参数的串联。 使用 $util.inspect() 将每个参数转换为字符串。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>$util<span class="token punctuation">.</span><span class="token function">format</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#39;1 2 3&#39;</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
            </div>
          </div>
          <p>如果只有一个参数被传递给 $util.format() ，它会按原样返回，没有任何格式。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>$util<span class="token punctuation">.</span><span class="token function">format</span><span class="token punctuation">(</span><span class="token string">&#39;%% %s&#39;</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#39;%% %s&#39;</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
            </div>
          </div>
          <h2 id="util-inspect-object-options" tabindex="-1"><a class="header-anchor"
              href="#util-inspect-object-options" aria-hidden="true">#</a> $util.inspect(object[, options])</h2>
          <ul>
            <li><code><span class="token property">object</span></code> {any} 任何 JavaScript 原语或对象。</li>
            <li><code>选项</code> {对象} <ul>
                <li><code><span class="token property">showHidden</span></code> {boolean} 如果为
                  <code><span class="token boolean">true</span></code>，则
                  <code><span class="token property">object</span></code> 的不可枚举符号和属性将包含在格式化结果中。
                  默认为<code><span class="token boolean">false</span></code>。</li>
                <li><code><span class="token property">depth</span></code> {number}
                  指定格式化<code><span class="token property">object</span></code>时递归的次数。
                  这对于检查大型复杂对象很有用。默认为<code><span class="token number">2</span></code>。
                  为了让它无限期地递归，传递<code><span class="token keyword">null</span></code>。</li>
              </ul>
            </li>
            <li><code><span class="token property">colors</span></code> {boolean} 如果为
              <code><span class="token boolean">true</span></code>，输出将使用 ANSI 颜色样式代码。
              默认为<code><span class="token boolean">false</span></code>。 颜色是可自定义的，请参阅 <a
                href="#util_customizing_util_inspect_colors">Customizing
                <code>$util<span class="token punctuation">.</span>inspect</code> colors</a>。</li>
            <li><code><span class="token property">customInspect</span></code> {boolean} 如果为
              <code><span class="token boolean">false</span></code>，则不会调用在被检查的<code><span class="token property">object</span></code>上导出的自定义<code><span class="token function">inspect</span><span class="token punctuation">(</span>depth<span class="token punctuation">,</span> opts<span class="token punctuation">)</span></code>函数。默认为<code><span class="token boolean">true</span></code>。
            </li>
          </ul>
          <p>
            <code>$util<span class="token punctuation">.</span><span class="token function">inspect</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>
            方法返回 <code><span class="token property">object</span></code> 的字符串表示形式，主要用于调试。 可以传递额外的
            <code><span class="token property">options</span></code>来改变格式化字符串的某些方面。</p>
          <p>以下示例检查 <code><span class="token property">$util</span></code> 对象的所有属性：</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>$util<span class="token punctuation">.</span><span class="token function">inspect</span><span class="token punctuation">(</span>$util<span class="token punctuation">,</span> <span class="token punctuation">{</span> <span class="token literal-property property">showHidden</span><span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span> <span class="token literal-property property">depth</span><span class="token operator">:</span> <span class="token keyword">null</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <p>
            值可以提供它们自己的自定义<code><span class="token function">inspect</span><span class="token punctuation">(</span>depth<span class="token punctuation">,</span> opts<span class="token punctuation">)</span></code>函数，当调用这些函数时，它们会在递归检查中接收当前的
            <code><span class="token property">depth</span></code>
            ，以及传递给<code>$util<span class="token punctuation">.</span><span class="token function">inspect</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>的选项对象。
          </p>
          <h2 id="util-extend-target-source" tabindex="-1"><a class="header-anchor" href="#util-extend-target-source"
              aria-hidden="true">#</a> $util.extend(target, source)</h2>
          <ul>
            <li><code><span class="token property">target</span></code> {object} 目标构造函数</li>
            <li><code><span class="token property">source</span></code> {object} 要继承的构造函数</li>
          </ul>
          <p>将原型方法从一个构造函数继承到另一个构造函数。类似于Node.js中的<code>util<span class="token punctuation">.</span>inherits</code>。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code><span class="token keyword">function</span> <span class="token function">SuperClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>value <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token class-name">SuperClass</span><span class="token punctuation">.</span>prototype<span class="token punctuation">.</span><span class="token function-variable function">increment</span> <span class="token operator">=</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>value<span class="token operator">++</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

$util<span class="token punctuation">.</span><span class="token function">extend</span><span class="token punctuation">(</span>ChildClass<span class="token punctuation">,</span> SuperClass<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token keyword">function</span> <span class="token function">ChildClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token function">SuperClass</span><span class="token punctuation">.</span><span class="token function">call</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token class-name">ChildClass</span><span class="token punctuation">.</span>prototype<span class="token punctuation">.</span><span class="token function-variable function">print</span> <span class="token operator">=</span> <span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">.</span>value<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>


<span class="token keyword">let</span> child <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">ChildClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
child<span class="token punctuation">.</span><span class="token function">increment</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
child<span class="token punctuation">.</span><span class="token function">print</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <h2 id="util-isarray-object" tabindex="-1"><a class="header-anchor" href="#util-isarray-object"
              aria-hidden="true">#</a> $util.isArray(object)</h2>
          <blockquote>
            <p>稳定性：0 - 已弃用</p>
          </blockquote>
          <ul>
            <li><code><span class="token property">object</span></code> {any}</li>
          </ul>
          <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray"
              target="_blank"
              rel="noopener noreferrer"><code>Array<span class="token punctuation">.</span>isArray</code><span><svg
                  class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"
                  x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
                  <path fill="currentColor"
                    d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                  </path>
                  <polygon fill="currentColor"
                    points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                  </polygon>
                </svg><span class="external-link-icon-sr-only">open in new window</span></span></a> 的内部别名。</p>
          <p>如果给定的 <code><span class="token property">object</span></code> 是
            <code><span class="token property">Array</span></code>，则返回
            <code><span class="token boolean">true</span></code>。 否则，返回
            <code><span class="token boolean">false</span></code>。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>$util<span class="token punctuation">.</span><span class="token function">isArray</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isArray</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">Array</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isArray</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <h2 id="util-isboolean-object" tabindex="-1"><a class="header-anchor" href="#util-isboolean-object"
              aria-hidden="true">#</a> $util.isBoolean(object)</h2>
          <blockquote>
            <p>稳定性：0 - 已弃用</p>
          </blockquote>
          <ul>
            <li><code><span class="token property">object</span></code> {any}</li>
          </ul>
          <p>如果给定的 <code><span class="token property">object</span></code> 是
            <code><span class="token property">Boolean</span></code>，则返回
            <code><span class="token boolean">true</span></code>。 否则，返回
            <code><span class="token boolean">false</span></code>。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>$util<span class="token punctuation">.</span><span class="token function">isBoolean</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
$util<span class="token punctuation">.</span><span class="token function">isBoolean</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
$util<span class="token punctuation">.</span><span class="token function">isBoolean</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <h2 id="util-isdate-object" tabindex="-1"><a class="header-anchor" href="#util-isdate-object"
              aria-hidden="true">#</a> $util.isDate(object)</h2>
          <blockquote>
            <p>稳定性：0 - 已弃用</p>
          </blockquote>
          <ul>
            <li><code><span class="token property">object</span></code> {any}</li>
          </ul>
          <p>如果给定的 <code><span class="token property">object</span></code> 是
            <code><span class="token property">Date</span></code>，则返回
            <code><span class="token boolean">true</span></code>。 否则，返回
            <code><span class="token boolean">false</span></code>。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>$util<span class="token punctuation">.</span><span class="token function">isDate</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">Date</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isDate</span><span class="token punctuation">(</span><span class="token function">Date</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// false (without &#39;new&#39; returns a String)</span>
$util<span class="token punctuation">.</span><span class="token function">isDate</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <h2 id="util-iserror-object" tabindex="-1"><a class="header-anchor" href="#util-iserror-object"
              aria-hidden="true">#</a> $util.isError(object)</h2>
          <blockquote>
            <p>稳定性：0 - 已弃用</p>
          </blockquote>
          <ul>
            <li><code><span class="token property">object</span></code> {any}</li>
          </ul>
          <p>如果给定的 <code><span class="token property">object</span></code> 是 <a
              href="https://pro.autojs.org/docs/zh/v8/errors.html#errors_class_error"
              class=""><code><span class="token property">Error</span></code></a>，则返回
            <code><span class="token boolean">true</span></code>。
            否则，返回<code><span class="token boolean">false</span></code>。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>$util<span class="token punctuation">.</span><span class="token function">isError</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isError</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">TypeError</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isError</span><span class="token punctuation">(</span><span class="token punctuation">{</span> <span class="token literal-property property">name</span><span class="token operator">:</span> <span class="token string">&#39;Error&#39;</span><span class="token punctuation">,</span> <span class="token literal-property property">message</span><span class="token operator">:</span> <span class="token string">&#39;an error occurred&#39;</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <p>请注意，此方法依赖于
            <code><span class="token class-name">Object</span><span class="token punctuation">.</span>prototype<span class="token punctuation">.</span><span class="token function">toString</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code>
            行为。 当 <code><span class="token property">object</span></code> 参数操作 <code>@@toStringTag</code> 时，可能会获得不正确的结果。
          </p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code><span class="token keyword">let</span> obj <span class="token operator">=</span> <span class="token punctuation">{</span> <span class="token literal-property property">name</span><span class="token operator">:</span> <span class="token string">&#39;Error&#39;</span><span class="token punctuation">,</span> <span class="token literal-property property">message</span><span class="token operator">:</span> <span class="token string">&#39;an error occurred&#39;</span> <span class="token punctuation">}</span><span class="token punctuation">;</span>

$util<span class="token punctuation">.</span><span class="token function">isError</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
obj<span class="token punctuation">[</span>Symbol<span class="token punctuation">.</span>toStringTag<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token string">&#39;Error&#39;</span><span class="token punctuation">;</span>
$util<span class="token punctuation">.</span><span class="token function">isError</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <h2 id="util-isfunction-object" tabindex="-1"><a class="header-anchor" href="#util-isfunction-object"
              aria-hidden="true">#</a> $util.isFunction(object)</h2>
          <blockquote>
            <p>稳定性：0 - 已弃用</p>
          </blockquote>
          <ul>
            <li><code><span class="token property">object</span></code> {any}</li>
          </ul>
          <p>如果给定的 <code><span class="token property">object</span></code> 是
            <code><span class="token property">Function</span></code>，则返回
            <code><span class="token boolean">true</span></code>。 否则，返回
            <code><span class="token boolean">false</span></code>。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>
<span class="token keyword">function</span> <span class="token function">Foo</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
<span class="token keyword">let</span> <span class="token function-variable function">Bar</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>

$util<span class="token punctuation">.</span><span class="token function">isFunction</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
$util<span class="token punctuation">.</span><span class="token function">isFunction</span><span class="token punctuation">(</span>Foo<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isFunction</span><span class="token punctuation">(</span>Bar<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <h2 id="util-isnull-object" tabindex="-1"><a class="header-anchor" href="#util-isnull-object"
              aria-hidden="true">#</a> $util.isNull(object)</h2>
          <blockquote>
            <p>稳定性：0 - 已弃用</p>
          </blockquote>
          <ul>
            <li><code><span class="token property">object</span></code> {any}</li>
          </ul>
          <p>如果给定的 <code><span class="token property">object</span></code> 严格为
            <code><span class="token keyword">null</span></code>，则返回
            <code><span class="token boolean">true</span></code>。 否则，返回
            <code><span class="token boolean">false</span></code>。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>
$util<span class="token punctuation">.</span><span class="token function">isNull</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
$util<span class="token punctuation">.</span><span class="token function">isNull</span><span class="token punctuation">(</span><span class="token keyword">undefined</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
$util<span class="token punctuation">.</span><span class="token function">isNull</span><span class="token punctuation">(</span><span class="token keyword">null</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <h2 id="util-isnullorundefined-object" tabindex="-1"><a class="header-anchor"
              href="#util-isnullorundefined-object" aria-hidden="true">#</a> $util.isNullOrUndefined(object)</h2>
          <blockquote>
            <p>稳定性：0 - 已弃用</p>
          </blockquote>
          <ul>
            <li><code><span class="token property">object</span></code> {any}</li>
          </ul>
          <p>如果给定的 <code><span class="token property">object</span></code> 是
            <code><span class="token keyword">null</span></code> 或
            <code><span class="token keyword">undefined</span></code>，则返回
            <code><span class="token boolean">true</span></code>。 否则， 返回
            <code><span class="token boolean">false</span></code>。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>
$util<span class="token punctuation">.</span><span class="token function">isNullOrUndefined</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
$util<span class="token punctuation">.</span><span class="token function">isNullOrUndefined</span><span class="token punctuation">(</span><span class="token keyword">undefined</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isNullOrUndefined</span><span class="token punctuation">(</span><span class="token keyword">null</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <h2 id="util-isnumber-object" tabindex="-1"><a class="header-anchor" href="#util-isnumber-object"
              aria-hidden="true">#</a> $util.isNumber(object)</h2>
          <blockquote>
            <p>稳定性：0 - 已弃用</p>
          </blockquote>
          <ul>
            <li><code><span class="token property">object</span></code> {any}</li>
          </ul>
          <p>如果给定的 <code><span class="token property">object</span></code> 是
            <code><span class="token property">Number</span></code>，则返回
            <code><span class="token boolean">true</span></code>。 否则，返回
            <code><span class="token boolean">false</span></code>。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>
$util<span class="token punctuation">.</span><span class="token function">isNumber</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
$util<span class="token punctuation">.</span><span class="token function">isNumber</span><span class="token punctuation">(</span><span class="token number">Infinity</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isNumber</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isNumber</span><span class="token punctuation">(</span><span class="token number">NaN</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <h2 id="util-isobject-object" tabindex="-1"><a class="header-anchor" href="#util-isobject-object"
              aria-hidden="true">#</a> $util.isObject(object)</h2>
          <blockquote>
            <p>稳定性：0 - 已弃用</p>
          </blockquote>
          <ul>
            <li><code><span class="token property">object</span></code> {any}</li>
          </ul>
          <p>如果给定的 <code><span class="token property">object</span></code> 严格来说是
            <code><span class="token property">Object</span></code> <strong>并且</strong> 不是
            <code><span class="token property">Function</span></code>，则返回
            <code><span class="token boolean">true</span></code>。 否则，返回
            <code><span class="token boolean">false</span></code>。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>
$util<span class="token punctuation">.</span><span class="token function">isObject</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
$util<span class="token punctuation">.</span><span class="token function">isObject</span><span class="token punctuation">(</span><span class="token keyword">null</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
$util<span class="token punctuation">.</span><span class="token function">isObject</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isObject</span><span class="token punctuation">(</span><span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <h2 id="util-isprimitive-object" tabindex="-1"><a class="header-anchor" href="#util-isprimitive-object"
              aria-hidden="true">#</a> $util.isPrimitive(object)</h2>
          <blockquote>
            <p>稳定性：0 - 已弃用</p>
          </blockquote>
          <ul>
            <li><code><span class="token property">object</span></code> {any}</li>
          </ul>
          <p>如果给定的 <code><span class="token property">object</span></code> 是原始类型，则返回
            <code><span class="token boolean">true</span></code>。 否则，返回
            <code><span class="token boolean">false</span></code>。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>$util<span class="token punctuation">.</span><span class="token function">isPrimitive</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isPrimitive</span><span class="token punctuation">(</span><span class="token string">&#39;foo&#39;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isPrimitive</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isPrimitive</span><span class="token punctuation">(</span><span class="token keyword">null</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isPrimitive</span><span class="token punctuation">(</span><span class="token keyword">undefined</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isPrimitive</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
$util<span class="token punctuation">.</span><span class="token function">isPrimitive</span><span class="token punctuation">(</span><span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
$util<span class="token punctuation">.</span><span class="token function">isPrimitive</span><span class="token punctuation">(</span><span class="token regex"><span class="token regex-delimiter">/</span><span class="token regex-source language-regex">^$</span><span class="token regex-delimiter">/</span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
$util<span class="token punctuation">.</span><span class="token function">isPrimitive</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">Date</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <h2 id="util-isregexp-object" tabindex="-1"><a class="header-anchor" href="#util-isregexp-object"
              aria-hidden="true">#</a> $util.isRegExp(object)</h2>
          <blockquote>
            <p>稳定性：0 - 已弃用</p>
          </blockquote>
          <ul>
            <li><code><span class="token property">object</span></code> {any}</li>
          </ul>
          <p>如果给定的 <code><span class="token property">object</span></code> 是
            <code><span class="token property">RegExp</span></code>，则返回
            <code><span class="token boolean">true</span></code>。 否则，返回
            <code><span class="token boolean">false</span></code>。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>$util<span class="token punctuation">.</span><span class="token function">isRegExp</span><span class="token punctuation">(</span><span class="token regex"><span class="token regex-delimiter">/</span><span class="token regex-source language-regex">some regexp</span><span class="token regex-delimiter">/</span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isRegExp</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">RegExp</span><span class="token punctuation">(</span><span class="token string">&#39;another regexp&#39;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isRegExp</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <h2 id="util-isstring-object" tabindex="-1"><a class="header-anchor" href="#util-isstring-object"
              aria-hidden="true">#</a> $util.isString(object)</h2>
          <blockquote>
            <p>稳定性：0 - 已弃用</p>
          </blockquote>
          <ul>
            <li><code><span class="token property">object</span></code> {any}</li>
          </ul>
          <p>如果给定的 <code><span class="token property">object</span></code> 是
            <code><span class="token property">string</span></code>，则返回
            <code><span class="token boolean">true</span></code>。 否则，返回
            <code><span class="token boolean">false</span></code>。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code>$util<span class="token punctuation">.</span><span class="token function">isString</span><span class="token punctuation">(</span><span class="token string">&#39;&#39;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isString</span><span class="token punctuation">(</span><span class="token string">&#39;foo&#39;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isString</span><span class="token punctuation">(</span><span class="token function">String</span><span class="token punctuation">(</span><span class="token string">&#39;foo&#39;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isString</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
          <h2 id="util-isundefined-object" tabindex="-1"><a class="header-anchor" href="#util-isundefined-object"
              aria-hidden="true">#</a> $util.isUndefined(object)</h2>
          <blockquote>
            <p>稳定性：0 - 已弃用</p>
          </blockquote>
          <ul>
            <li><code><span class="token property">object</span></code> {any}</li>
          </ul>
          <p>如果给定的 <code><span class="token property">object</span></code> 是
            <code><span class="token keyword">undefined</span></code>，则返回
            <code><span class="token boolean">true</span></code>。 否则，返回
            <code><span class="token boolean">false</span></code>。</p>
          <div class="language-javascript ext-js line-numbers-mode">
            <pre class="language-javascript"><code><span class="token keyword">let</span> foo <span class="token operator">=</span> <span class="token keyword">undefined</span><span class="token punctuation">;</span>
$util<span class="token punctuation">.</span><span class="token function">isUndefined</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
$util<span class="token punctuation">.</span><span class="token function">isUndefined</span><span class="token punctuation">(</span>foo<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: true</span>
$util<span class="token punctuation">.</span><span class="token function">isUndefined</span><span class="token punctuation">(</span><span class="token keyword">null</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Returns: false</span>
</code></pre>
            <div class="line-numbers" aria-hidden="true">
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
              <div class="line-number"></div>
            </div>
          </div>
        </div><!---->
        <footer class="page-meta"><!---->
          <div class="meta-item update-time"><span class="label">上次编辑于: </span><!----></div>
          <div class="meta-item contributors"><span class="label">贡献者: </span><!--[--><!--[--><span class="contributor"
              title="email: 946994919@qq.com">hyb1996</span><!--]--><!--]--></div>
        </footer>
        <nav class="page-nav"><!----><a href="webSocket.html" class="nav-link next" aria-label="WebSocket">
            <div class="hint">下一页<span class="arrow right"></span></div>
            <div class="link">WebSocket<!----></div>
          </a></nav><!----><!----><!--]-->
      </main><!--]--><!----><!--]-->
    </div><!--]--><!----><!----><!--]-->
  </div>
  <script type="module" src="../../assets/app.6aa2b576.js" defer></script>
</body>

</html>